/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023.
 * Description: add audit extend functions.
 * Author: weiyuchen
 * Create: 2023-09-16
 */

#include <internal/hkids_internal.h>

/*
 * "struct audit_buffer" is defined in "audit.c".
 * Internal members cannot be used by "include <linux/audit.h>".
 * Therefore, you need to add self-developed functions in "audit.c".
 * include "audit_extend.c" in kernel/audit.c
 */
#ifdef CONFIG_HKIDS_CHK_MAC_VIOLATION
char *audit_get_skbuff_data(struct audit_buffer *ab)
{
	struct nlmsghdr *nlh;
	char *data = NULL;

	if (!ab)
		return NULL;

	if (ab->skb) {
		nlh = nlmsg_hdr(ab->skb);
		data = nlmsg_data(nlh);
	}
	return data;
}
#endif
